function [] = fun_k_means(point,k,count,xlab,ylab,tit,newfigure)
    if(newfigure == 1)
        figure
    end
    [N,~] = size(point);
    center = point(1:k,:);  % 令前k个点为初始的聚类中心
    
    distance_square = zeros(N,k);
    while count~=0
        for i = 1:k
            distance_square(:,i) = sum((point - repmat(center(i,:),N,1)).^2,2);
            str = ['Center',num2str(i),'=[];'];
            eval(str);
        end  % 计算到每个点到各个聚类中心的距离
        
        for i = 1:N
            minposition = find(distance_square(i,:)==min(distance_square(i,:)));
            str = ['Center',num2str(minposition)];
            eval([str,'=[',str,';point(i,:)];']);
        end  % 建立第一次分类后的分类点集
        
        for i = 1:k
            str = ['Center',num2str(i)];
            eval(['center_New(',num2str(i),',:) = mean(',str,',1);']);
        end  % 计算新的聚类中心
        
        if sym(sum((center_New - center).^2)) == 0
            break
        else
            center = center_New;
        end  % 如果中心未改变则跳出循环
        
        count = count-1;
    end
    
    for i = 1:k
        I = num2str(i);
%         disp(['第',I,'组聚类的点集为：']);
%         disp(eval(['Center',I]));
    end  % 把聚类点显示出来
    
    hold on
    for i = 1:k
        str = ['Center',num2str(i)];
        plot(eval([str,'(:,1)']),eval([str,'(:,2)']),'.','Markersize',15,'color',[rand rand rand]);
        eval(['kn = boundary(',str,'(:,1),',str,'(:,2),0.1);'])
        if isempty(kn)
            eval(['plot(',str,'(:,1),',str,'(:,2));']);
        else
            eval(['plot(',str,'(kn,1),',str,'(kn,2));']);
        end
        plot(center(:,1),center(:,2),'k+');
    end  % 绘图
    title(tit);
    xlabel(xlab);
    ylabel(ylab);
end